/**
 * File TestReceivedMsgModel.java 
 */
package cstest.model;

import static org.junit.Assert.*;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import cs.entity.UserTextMessage;
import cs.model.ReceivedMsgModel;

/**
 * Package  cstest.model
 * Project ChatSystemG1 - INSA 4INFOA1 - 2013/2014
 * @author Julie DUMONS & Juste OUEDRAOGO
 *
 */
public class TestReceivedMsgModel {

	ReceivedMsgModel rmm1,rmm2 ; 
	UserTextMessage um1, um2 ; 

	/**
	 * @throws java.lang.Exception
	 */
	@Before
	public void setUp() throws Exception {
		rmm2 = new ReceivedMsgModel() ;
		um1 = new UserTextMessage(null, null) ; 
		um2 = new UserTextMessage(null, null) ; 

	}

	/**
	 * @throws java.lang.Exception
	 */
	@After
	public void tearDown() throws Exception {
		um1 = null ;
		um2 = null ; 
	}

	/**
	 * Test method for {@link cs.model.ReceivedMsgModel#ReceivedMsgModel()}.
	 */
	@Test
	public void testReceivedMsgModel() {
		assertNull(rmm1) ; 
		rmm1 = new ReceivedMsgModel() ; 
		assertNotNull(rmm1);
		
	}

	/**
	 * Test method for {@link cs.model.ReceivedMsgModel#addReceivedMsg(cs.entity.UserTextMessage)}.
	 */
	@Test
	public void testAddReceivedMsg() {
		assertNull(rmm2.getRemoveReceivedMsg());
		rmm2.addReceivedMsg(um1);
		assertNotNull(rmm2.getRemoveReceivedMsg());
	}

	/**
	 * Test method for {@link cs.model.ReceivedMsgModel#getRemoveReceivedMsg()}.
	 */
	@Test
	public void testGetRemoveReceivedMsg() {
		assertNull(rmm2.getRemoveReceivedMsg());
		rmm2.addReceivedMsg(um1);
		assertSame(rmm2.getRemoveReceivedMsg(), um1);
	}

	/**
	 * Test method for {@link cs.model.ReceivedMsgModel#removeAllReceivedMsg()}.
	 */
	@Test
	public void testRemoveAllReceivedMsg() {
		assertNull(rmm2.getRemoveReceivedMsg());
		rmm2.addReceivedMsg(um1);
		rmm2.addReceivedMsg(um2);
		rmm2.removeAllReceivedMsg();
		assertNull(rmm2.getRemoveReceivedMsg());


	}

}
